var statisticsAjax;
var getStatisticsCheckingInterval;

function getStatistics(){
	statisticsAjax = fire("GET","Statistics",new Object(),statisticsListener);
}

function statisticsListener(){
	var obj = validResponse(statisticsAjax);
	if (obj != undefined && obj.soldItems != null && obj.unSoldItems != null){
		setStatisticsView(obj.soldItems,obj.unSoldItems);
	}
}


function startRefreshingStatistics(){
	setTimeout(getStatistics, 100);
	getStatisticsCheckingInterval = setInterval(getStatistics, 5000);
}

startRefreshingStatistics();

function stopRefreshingStatistics(){
	clearInterval(getStatisticsCheckingInterval);
}